HPI3: Data Compression // Advanced

 
King Frederick is having a hard time encoding his numerous kingdom manuscripts, and needs your help to compress his documents to a more manageable size. Frederick has (ahead of his time!) developed a system whereby a string of text "aaaabbbccddef" is converted to a smaller from such as "a4b3c2d2e1f1". Note that each consecutive string of letters within the text is shortened to a form of the first letter ("a" for example) and a number representing how long the consecutive string is.

Input Format

The original string.

Sample Input

INPUT #1
abcaaaaaaaaadseeeeeeeq

INPUT #2
aaaaaaaaa

Output Format

The compressed version of this string.

Sample Output

OUTPUT #1
a1b1c1a9d1s1e7q

OUTPUT #2
a9




You must be logged in to submit a solution.